﻿Chenxin.UI.RateLog = Chenxin.extend(Chenxin.UI.PageCommon, {
    autoInitForm: false,
    actionUrl: '/service/logic/RateLog.ashx',
    createSearch: function() {
        return new Chenxin.UI.RateLogSearch({
            scope: this
        });
    },
    createGrid: function() {
        return new Chenxin.UI.JsonGrid({
            actionUrl: this.actionUrl + '?op=getlist',
            pageSize: 100,
            hasPage: true,
            cellBorder: true,
            height: 400,
            exportAble:false,
            autoLoad: false,
            renderTo: 'RateLog_table',
            hasCheckBox: false,
            id: 'searchtable',
            title: '80%调整率表',
            scope: this,
            columns: {
                RateDate: {
                    width: 80,
                    head: '调整日期',
                    sortable: true
                },
                ContractCode: {
                    width: 150,
                    head: '成交编号',
                    sortable: true
                },
                ContractDate: {
                    width: 80,
                    head: '成交日期',
                    sortable: true
                },
                ArchivementDate: {
                    width: 80,
                    head: '业绩归属',
                    sortable: true
                },
                HouseAddress: {
                    width: 300,
                    head: '地址',
                    sortable: true
                },
                DiscountRate: {
                    width: 80,
                    head: '调整率',
                    sortable: true,
                    renderer: function(val, c, row) {
                        return (val*100)+'%';
                    }
                },
                Depart: {
                    width: 250,
                    head: '成交门店'
                },
                Employee: {
                    width: 200,
                    head: '成交业务员'
                },
                Point: {
                    width: 150,
                    head: '点数'
                }
            }
        });
    },
    initComponent: function() {
        Chenxin.UI.RateLog.superclass.initComponent.call(this);
    }
});

/**
*查询面板
*/
Chenxin.UI.RateLogSearch = Chenxin.extend(Chenxin.UI.SearchCommon, {
    id: 'RateLog_search',
    initEvent: function() {
        var _this = this;

        //查询按钮
        $('#btnSreachOprLogs').click(function() {
            _this.scope.reloadGrid("", 0);
        });

        //关键字
        $('#txtkeyword').defText({
            deftxt: '输入成交编号/地址'
        });

    },
    createComboList: function() {

        var cmbDateType = new Chenxin.UI.Combo({
            containerId: '#datetype',
            name: 'datetype',
            tbxWidth: 55,
            addPleaseSelected: false,
            items: [{ val: 'RateDate', txt: '调整日期' }, { val: 'ContractDate', txt: '成交日期' }, { val: 'ArchivementDate', txt: '业绩归属'}]
        });

        return [cmbDateType];
    },
    initComponent: function() {
        Chenxin.UI.RateLogSearch.superclass.initComponent.call(this);
    }
});

$(document).ready(function() {
    this.RateLog = new Chenxin.UI.RateLog();
});